#-*-coding:utf-8-*-

from django import forms

class RegisterForm(forms.Form):
    username = forms.CharField(max_length = 75, label = u'用户名')
    password = forms.CharField(widget = forms.PasswordInput, label = u'密码')
    password_confirm = forms.CharField(widget = forms.PasswordInput, label = u'密码确认')
    email = forms.EmailField(label = '邮件地址')

    def password_confirm_clean(self):
        if self.cleaned_data['password'] != self.cleaned['password_confirm']:
            raise u'两次密码不一样'
        else:
            return self.cleaned_data['password_confirm']

class LoginForm(forms.Form):
    username = forms.CharField(max_length = 75, label = u'用户名')
    password = forms.CharField(widget = forms.PasswordInput, label = u'密码')
